package com.eaoa.uc.address.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.eaoa.base.EABaseAction;
import com.eaoa.query.pub.PubCityQuery;
import com.eaoa.uc.address.form.PubCityCondition;
import com.eaoa.uc.address.form.PubCitySearchForm;
import com.stony.core.util.CoreUtils;

public class PubCityManageSearchAction extends EABaseAction{
	protected ActionForward doWork(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
				
		PubCitySearchForm sform = (PubCitySearchForm) form;
		sform.initConditionPost();
		PubCityCondition condition = (PubCityCondition) sform.getCondition();
		PubCityQuery query = new PubCityQuery();		
		query.setCityname(condition.getCityname());
		query.setParentno(CoreUtils.parseLong(condition.getParentno()));
		query.setLayer(new Long(2));
		query.setIsLock("N");
		query.setOrder();
		
		query.setPageRange(sform.getPageinfo());
		query.execute();
		
		request.setAttribute("results", query.getResults());
		return mapping.findForward("success");		
	}
}